*set the below to the directory containing the raw_dta and do folders.  If you want to bypass the bootstrap for Fig A11 please also place bootstrapped.dta in the created_dta folder before running.
global cwd ""
cd $cwd

*================================
*SETTINGS
*================================
clear all
set more off
set trace off
set scheme s1mono
set linesize 255
set matsize 2000
set maxvar 15000
cap log close _all
graph close _all

cap mkdir ".\created_dta"
cap mkdir ".\output"
global outputfolder ".\output"

global FE1 mos_tc_post_yr_terms 
global FE1_as mos_tc_post_yr_terms_as
global FE1_qtr mos_tc_post_qtr_terms
global SEa vce(robust)
global SEb robust 
global controls 
global SCALE = 10
global NEWINST instrument_mths_dep_qtr
global NEWINSTLAB Deployment Instrument
global NEWENDOG mths_dep_win_3yr
global NEWENDOGLAB 10 Months Deployed 
global ANYDEPINST instrument_any_dep_qtr
global ivregsettings nocollin noid
global endx 36 
global rest num_qtr_allowed
global rawdataorig raw_dta 


*codes are meant to be run in the below order.

**** BUILD MAIN ANALYSIS DATA SET ****
do do/build_base_data 
do do/prep_base_data  
do do/clean_dspo_ndi_death_data
do do/merge_outcomes  
do do/final_prep 
*with women
	do do/merge_outcomes_incw 
	do do/final_prep_incw 


**** BUILD 2001-FORWARD DATA SET****
do do/build_cohortdecomp_data  
do do/prep_cohortdecomp_data  
do do/merge_outcomes_cohortdecomp 
do do/final_prep_cohortdecomp 


**** CREATE ALL TABLES AND FIGURES FROM BELOW ANALYSIS DATA SETS *****
global wholesamp whole_samp_w_outcomes_final 
global analysissamp analysis_samp_w_outcomes_final
global analysissampwomen analysis_samp_w_outcomes_final_incw

*MAIN TABLES
do "do\tables"
*APPENDIX TABLES 
do "do\appendix_tables"
*MAIN FIGURES 
do "do\figures"
*APPENDIX FIGURES 
do "do\appendix_figures"
